package collection.queue;

import org.junit.Test;

import java.util.PriorityQueue;

public class PriorityQueueTest {

    @Test
    public void test() {
        PriorityQueue<String> queue = new PriorityQueue<String>();
        queue.offer("11111");
        queue.offer("22222");
        queue.offer("33333");
        queue.offer("44444");
        System.out.println("队列中的个数：" + queue.size());

        while (queue.size() != 0) {
            // 从队列中取出数据
            String str = queue.poll();
            System.out.println(str);
            System.out.println("队列剩余个数 ---> " + queue.size());
        }
    }
}
